# ！/usr/bin/ python3
# -*- codeing = utf-8 -*-
# @Time :2022/1/1 19:28
# @Author:wuhha
# @File : urls.py
# @Software: PyCharm
from django.urls import path, include
from django.views.decorators.cache import cache_page

from youpu import views

app_name = "youpu"

urlpatterns = [
      path("", views.UnansweredQuestionListView.as_view(), name='qa_unanswered_q'),  # 未回答问题列表【网站首页】【无需登录】

      path("users/register/", views.register, name="users_register"),  # 注册
      path("users/login/", views.login, name="users_login"),  # 登录
      path("users/logout/", views.logout, name="users_logout"),  # 注销
      path("users/send_verify_code/", views.get_verify_code, name="users_get_verify_code"),  # 向用户邮箱发送验证码
      path("users/update/", views.UserUpdateView.as_view(), name="users_update"),  # 用户信息更新
      path("users/<str:username>/", views.UserDetailView.as_view(), name="users_detail"),  # 用户信息详情页

      path('news/list/', views.NewsListView.as_view(), name='news_list'),#动态列表【动态模块默认页面】
      path('news/post-news/', views.post_news, name='news_post_news'),  # 新增动态{发一条动态，增加2点油力值}
      path('news/delete/<pk>/', views.NewsDeleteView.as_view(), name='news_delete_news'),  # 删除动态
      path('news/like/', views.like_news, name='news_like_post'),  # 点赞动态{点赞者增加1点油力值，取消赞则减1}
      path('news/get-thread/', views.get_thread, name='news_get_thread'),  # 返回动态的评论
      path('news/post-comment/', views.post_comment, name='news_post_comments'),  # 发表评论{评论者增加1点油力值}
      path('news/update-interactions/', views.update_interactions, name='news_update_interactions'),# 更新互动信息

      path('articles/list/', views.ArticlesListView.as_view(), name='articles_list'),#获得已发布的文章列表【文章模块默认页面】
      path('articles/write-new-article/', views.CreateArticleView.as_view(), name='articles_write_new'),#创建文章{增加3点油力值}
      path('articles/drafts/', views.DraftsListView.as_view(), name='articles_drafts'),#草稿箱文章列表
      path('articles/like/', views.like_articles, name='articles_like_post'),  # 点赞文章{点赞者增加1点油力值，取消赞则减1}【注意，此路由需要放在下一条的上方，防止路由匹配错误】
      path('articles/<str:slug>/', cache_page(60 * 5)(views.DetailArticleView.as_view()),name='articles_article'),#文章详情
      path('articles/edit/<int:pk>/', views.EditArticleView.as_view(), name='articles_edit_article'),#编辑文章

      path('qa/unanswered/', views.UnansweredQuestionListView.as_view(), name='qa_unanswered_q'),#未回答问题列表【问题模块默认页面】
      path('qa/answered/', views.AnsweredQuestionListView.as_view(), name='qa_answered_q'),#已回答问题列表
      path('qa/indexed/', views.QuestionListView.as_view(), name='qa_all_q'),#所有问题页
      path('qa/ask-question/', views.CreateQuestionView.as_view(), name='qa_ask_question'),#用户提问{增加2点油力值}
      path('qa/question-detail/<int:pk>/', views.QuestionDetailView.as_view(), name='qa_question_detail'),#问题详情页
      path('qa/propose-answer/<int:question_id>/', views.CreateAnswerView.as_view(), name='qa_propose_answer'),#回答问题{增加2点油力值}
      path('qa/question/vote/', views.question_vote, name='qa_question_vote'),#给问题投票{投票者增加1点油力值}
      path('qa/answer/vote/', views.answer_vote, name='qa_answer_vote'),#给回答投票{投票者增加1点油力值}
      path('qa/accept-answer/', views.accept_answer, name='qa_accept_answer'),#提问者接受回答{被接受者增加3点油力值}

      path('messager/list/', views.MessagesListView.as_view(), name='messager_messages_list'),#私信列表
      path('messager/send-message/', views.send_message, name='messager_send_message'),#发送私信{增加1点油力值}
      path('messager/receive-message/', views.receive_message, name='messager_receive_message'),#接收私信
      path('messager/<username>/', views.ConversationListView.as_view(), name='messager_conversation_detail'),#获取与指定用户的私信内容

      path('notifications/list/', views.NotificationUnreadListView.as_view(), name='notifications_unread'),#未读通知列表
      path('notifications/mark-as-read/<slug>/', views.mark_as_read, name='notifications_mark_as_read'),#根据slug标为已读
      path('notifications/mark-all-as-read/', views.mark_all_as_read, name='notifications_mark_all_read'),#将所有通知标为已读
      path('notifications/latest-notifications/', views.get_latest_notifications, name='notifications_latest_notifications'),#最近的未读通知

      path('hotlist/index/', views.get_hotlist_index, name='hotlist_index'),#热榜界面
      # path('hotlist/question/', views.get_hotlist_questions, name='hotlist_questions'),#问题热搜列表
      # path('hotlist/article/', views.get_hotlist_articles, name='hotlist_articles'),#文章热搜列表
      # path('hotlist/wordcloud/', views.get_hotlist_wordcloud, name='hotlist_wordcloud'),#标签词云

      path('search/list/', views.get_search_reuslt_list, name='search_list'),#搜索结果页面
]
# + [
#     path("download/<int:image_id>", views.download, name="download"),#根据蓝鲸文档，文件资源下载路由
#     path("upload/", views.upload, name="upload")#根据蓝鲸文档，文件资源上传路由
#  ]
